<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$plugin_name = $_RQ['basicname'] ? $_RQ['basicname'] : '';
if($_RQ['op']=='get'){
	//显示统计数据
		$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$mounthtime =  mktime(0,0,0,date('m'),1,date('Y'));
		$access=array();
		$access['wechat_day']=pdo_count('jy_worker_ewm_log',array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$_SESSION['onemerchid'],'createtime >'=>$daytime));
		$access['wechat_month']=pdo_count('jy_worker_ewm_log',array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$_SESSION['onemerchid'],'createtime >'=>$mounthtime));
		$access['wechat_all']=pdo_count('jy_worker_ewm_log',array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$_SESSION['onemerchid']));
		//月份
		for($i=0;$i<12;$i++){
				if($i==0){
					$yuestart = mktime(0,0,0,date('m'),1,date('Y'));
					$yueend = time();
					
				}else{
					$yuestart = mktime(0,0,0,date('m')-$i,1,date('Y'));
					$yueend = mktime(0,0,0,date('m')-$i+1,1,date('Y'));
				}
				$params=array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$_SESSION['onemerchid']);
				$params['createtime between']=array($yuestart,$yueend);
				$month12[$i] = date('Y-m',strtotime('-'.$i.' month'));
				//$monthaccess[]=pdo_count('jy_worker_ewm_log',$params);
				$accessline[$i]=pdo_count('jy_worker_ewm_log',$params);
				//$monthcredit2[]=pdo_getsum('core_members',$params,'credit2');
		}
		$accessline=array_reverse($accessline);
		$month12=array_reverse($month12);
		$return['htmls']=array(
				array('type'=>'data','one_num'=>4,'title'=>'扫码数据指标','datas'=>array(
					array('title'=>'今日扫码数据','data'=>$access['wechat_day']),
					array('title'=>'本月扫码数据','data'=>$access['wechat_month']),
					array('title'=>'总扫码数据','data'=>$access['wechat_all']),
				)),
				array('type'=>'echarts_arealine','ecid'=>'mobile','title'=>'月度扫码数据','datas'=>array(
					'datas'=>array(
						array('name'=>'扫码量','value'=>$accessline),
					),
					'xdatas'=>$month12,
				)),
		);
	exi($return);
}